/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package simulateurs.model.scheduler;
/**
 *
 * @author Alexandre
 */
public class Timer {

  private long startTime = 0;
  private long stopTime = 0;
  private long stop1 = 0;
  private long stop2=0;
  private long tempstop=0;
  private boolean pause=false;
 

    
    public void start() {
        this.startTime = System.currentTimeMillis();
        
    }

    
    public void stop() {
        this.stopTime = System.currentTimeMillis();
        
    }

    public void pause(){
    if(pause){
    stop2=System.currentTimeMillis();
    tempstop=stop2-stop1;
    pause=false;
    startTime+=tempstop;
    }
    else{
    stop1=System.currentTimeMillis();
    pause=true;
    
    }
    
    }
   
    public long getElapsedTime() {
        long elapsed;
       
        elapsed = (System.currentTimeMillis() - startTime)/1000;
 
        return elapsed;
    }

public long getFinalTime(){

long elapsed;
elapsed = (stopTime - startTime)/1000;

return elapsed;

}




}

